package com.tensquare.qa.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.tensquare.qa.pojo.Problem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProblemDao extends BaseMapper<Problem> {

    @Select("SELECT * FROM tb_problem,tb_pl where id=problemid AND labelid=#{labelid} ORDER BY replytime DESC")
    List<Problem> newList(@Param("labelid") String labelid, Page page1);

    @Select("SELECT * FROM tb_problem,tb_pl where id=problemid AND labelid=#{labelid} ORDER BY reply DESC")
    List<Problem> hotlist(String label, Page page1);

    @Select("SELECT * FROM tb_problem,tb_pl where id=problemid AND labelid=#{labelid} AND reply=0 ORDER BY createtime DESC")
    List<Problem> waitlist(String label, Page page1);

    @Select("SELECT * FROM tb_problem,tb_pl where id in(SELECT problemid FROM tb_pl )ORDER BY replytime DESC")
    List<Problem> newList2( Page page1);

}
